import requests

url = 'https://www.baidu.com'
response = requests.get(url)
print(response.cookies)
# 将cookiejar对象转换成字典
dict_cookies = requests.utils.dict_from_cookiejar(response.cookies)
print(dict_cookies)
# 转换回cookiejar对象（但是会丢失域名）
jar_cookies = requests.utils.cookiejar_from_dict(dict_cookies)
print(jar_cookies)